Page({
  onShow () {
    // 调用获取报修列表
    this.getRepairList()
  },
  // 获取报修列表
  async getRepairList () {
    // 发起请求
    const { code, data: { rows: repairList } } = await wx.http.get('/repair')
    // 检测接口成功了么
    if (code !== 10000) return wx.utils.toast()
    // 渲染数据
    this.setData({
      repairList
    })
  },
  goDetail (e) {
    wx.navigateTo({
      url: '/repair_pkg/pages/detail/index?id=' + e.mark.id,
    })
  },
  addRepair () {
    wx.navigateTo({
      url: '/repair_pkg/pages/form/index',
    })
  },
})
